<?php

namespace App\Services\Admin;


use App\Models\Region;

class RegionService
{
    public function getRegionById($id)
    {
        return Region::findOrFail($id);
    }
    //所有区域
    public function getArea()
    {
        return Region::with('allChilds')->where('status','T')->where('parent_id',0)->orderBy('sort','asc')->get();
    }

    public function getCityById($parent_id=0)
    {
        return Region::where('parent_id',$parent_id)->where('status','T')->orderBy('sort','asc')->get();
    }
}